package com.yaozheng.vocationaltraining.dialog;

import com.yaozheng.vocationaltraining.R;
import com.yaozheng.vocationaltraining.adapter.QuestionNumberListAdapter;
import com.yaozheng.vocationaltraining.iview.IQuestionNumberView;
import com.yaozheng.vocationaltraining.view.QuestionNumberListView;
import com.yaozheng.vocationaltraining.view.QuestionNumberListView_;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager.LayoutParams;

/**
 * 题目列表对话框
 *
 * @author Administrator
 */
public class QuestionNumberListDialog extends BaseDialog {
    QuestionNumberListView questionNumberListView;

    public QuestionNumberListDialog(Context context) {
        super(context, R.style.baseDialogStyleTheme, true, Gravity.BOTTOM);

    }

    /**
     * 得到ContentView
     */
    public void setContentView() {
        questionNumberListView = QuestionNumberListView_.build(getContext());
        // questionNumberListView.setBaseDialog(this);
        questionNumberListView.setBaseDialog(this);

        setContentView(questionNumberListView);

    }

    @Override
    protected void setAttributes(Window window, LayoutParams layoutpara) {

        layoutpara.height = (int) (window.getWindowManager().getDefaultDisplay()
                .getHeight() * 0.55);
        window.setWindowAnimations(R.style.baseDialogAnimation);
    }

    /**
     * 刷新数据
     *
     * @param iQuestionNumberView
     */
    public void refreshData(IQuestionNumberView iQuestionNumberView,
                            int answeredCount) {
        if (questionNumberListView != null) {
            questionNumberListView.refreshData(iQuestionNumberView,
                    answeredCount);
        }
    }
}
